<template>
  <div class="use-box">
    <mu-list>
      <mu-list-item v-for="(item,index) in orderList" :key="index">
        <mu-list-item-content>
          <mu-list-item-title>
            <div class="order-title">
              <span class="fleft">代理商电话: <a :href="'tel:'+item.mobile">{{item.mobile}}</a></span>
              <div class="_clear"></div>
            </div>
            <div class="order-title">
              <span class="fleft">订单金额: ¥{{item.ordergold}}</span>
              <span class="fright money"><span v-if="item.cardNo">(电卡订单)</span></span>
              <div class="_clear"></div>
            </div>
            <div v-if="item.orderstate!=='1'" class="order-title">
              <span class="fleft">实际时间: {{item.realHour}}</span>
              <div class="_clear"></div>
            </div>
            <div class="order-title">
              <span class="fleft">预计时间: {{item.hour}}小时</span>
              <div class="_clear"></div>
            </div>
            <div class="order-title">
              <span class="fleft">充电桩编号: {{item.parkId}}</span>
              <div class="_clear"></div>
            </div>
            <div class="order-title">
              <span class="fleft">端口号: {{item.name}}</span>
              <div class="_clear"></div>
            </div>
            <div class="order-sec-title">
<!--              <span class="fleft createtime">{{item.createTime}}</span>-->
               <span class="fright status" v-if="item.orderstate==='1'" style="color:#1FC3F2;">已下单</span>
                <span class="fright status" v-else-if="item.orderstate==='2'" style="color:#F6511D;">取消</span>
              <span class="fright status" v-else-if="item.orderstate==='3'" style="color:#1FC3F2;">支付成功</span>

               <span class="fright status" v-else-if="item.orderstate==='4'" style="color:#F6511D;">退款</span>
                <span class="fright status" v-else-if="item.orderstate==='5'" style="color:#3AB800;">完成</span>
              <div class="_clear"></div>
            </div>
          </mu-list-item-title>
          <mu-list-item-sub-title>
            <div class="fleft order-timebox order-title">
              <div class="time-title">开始时间</div>
              <div class="time-des">{{item.startTime}}</div>
            </div>
<!--            <div class="hour-box">-->
<!--              <span class="hour">{{item.hour}}h</span>-->
<!--            </div>-->

            <div class="fright order-timebox order-title">
              <div class="time-title">结束时间</div>
              <div class="time-des">{{item.endTime}}</div>
            </div>
            <div class="_clear"></div>
          </mu-list-item-sub-title>
        </mu-list-item-content>
      </mu-list-item>
    </mu-list>
   <div v-show="nolist" class="nolist">
        <span class="iconfont icon-charging"></span>
        <p>暂无订单</p>
      </div>
  </div>
</template>

<script>
    import { Toast } from "vant";
export default {
  data() {
    return {
      nolist: true,
      page:0,
      orderList: [

      ]
    };
  },
  methods: {
      getList() {
      this.$api.orderList(3,this.page).then(res => {
        // this.orderList = res.data.result.data;

        if(res.data.code==0){
           res.data.result.data.forEach(e => {
          this.orderList.push(e)
        });
        }else{
          Toast('已加载全部数据');
          this.loaded_all=true;
        }

      });
    },
     refresh() {
      this.refreshing = true;
      this.$refs.container.scrollTop = 0;
      setTimeout(() => {
        this.refreshing = false;
        this.getList();
      }, 2000);
    },
    load() {
      this.loading = true;
      setTimeout(() => {
        this.loading = false;
        this.page += 1;
        this.getList();
      }, 2000);
    }
  },
  mounted() {
    this.getList()
  },
    watch:{
    orderList:function(v){
      if(v==''){
        this.nolist=true;
      }else{
        this.nolist=false;
      }
    }
  },
};
</script>

<style>
</style>
